//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.baidu.trace.b;

import android.os.Handler;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

public final class a {
    private static a.a a;
    private static b b;

    public static a.a a() {
        return a;
    }

    public static b b() {
        return b;
    }

    protected static synchronized DataInputStream c() throws IOException {
        if(d()) {
            InputStream var0;
            return (var0 = b.d()) != null?new DataInputStream(var0):null;
        } else {
            throw new IOException();
        }
    }

    public static synchronized void a(byte[] var0, Handler var1) {
        if(d()) {
            try {
                b.a(var0);
            } catch (Exception var4) {
                if(var1 != null) {
                    var1.obtainMessage(4).sendToTarget();
                }
            } finally {
                ;
            }
        } else if(var1 != null) {
            var1.obtainMessage(4).sendToTarget();
        }

    }

    public static void a(a.a var0, e var1) {
        a = var0;
        if(a.a.a != var0) {
            if(a.a.b == var0) {
                if(b != null) {
                    b.a();
                    if(b instanceof j) {
                        int var2 = b.c();
                        b = null;
                        b = k.a(var2);
                    }
                } else {
                    b = k.a(8300);
                }

                b.a(var1);
            }

        } else {
            label27: {
                if(b != null) {
                    b.a();
                    if(!(b instanceof k)) {
                        break label27;
                    }

                    b = null;
                }

                b = j.e();
            }

            b.a(var1);
        }
    }

    public static boolean d() {
        if(b == null) {
            return false;
        } else {
            try {
                return b.b();
            } catch (Exception var0) {
                return false;
            }
        }
    }

    public static void e() {
        if(b != null) {
            b.a();
        }

    }

    static {
        a = a.a.a;
        b = null;
    }

    public static enum a {
        a,
        b;

        private a() {
        }

        static {
            a.a[] var10000 = new a.a[]{a, b};
        }
    }
}
